import { request } from './request'


// 获取用户列表
export function getUsers(queryInfo) {
  return request({
    url: 'users',
    params: queryInfo       //queryInfo是一个对象数据类型
  })
}

// 更改用户状态
export function changeUserState(uId, type) {
  return request({
    url: `users/${uId}/state/${type}`,
    data: {
      uId,
      type
    },
    method:'put'
  })
}

//添加用户
export function addUserN(userForm) {
  return request({
    url: '/users',
    data: userForm,
    method:'post'
  })
}

//获取用户信息
export function getUserMessage(id) {
  return request({
    url: `users/${id}`,
    params: {
      id
    }
  })
}

//编辑用户
export function editUserN(editForm) {
  return request({
    url: `users/${editForm.id}`,
    data: {
      id: editForm.id,
      email: editForm.email,
      mobile: editForm.mobile
    },
    method:'put'
  })
}

//删除用户
export function deletUser(id) {
  return request({
    url: `users/${id}`,
    params: {
      id
    },
    method:'delete'
  })
}
